package com.rd.student.jike.class2.lihongming.week731_806.Day0731;

/**
 * @Auther:Heinrich
 * @Date:2023/7/31-07-31-15:52
 * @Description:c230731.test
 * @version:1.0
 */
public class test08 {
    public static void main(String[] args) {
        int[] arr = new int[50];
        for (int i = 0; i < 50; i++) {
            arr[i] = i;
        }
        Shuffle(arr);
        for (int i = 0; i < 20; i++) {
            System.out.print(arr[i]+" ");
        }
    }
    public static void Shuffle(int[] arrays){
        int a = 0;
        int b = (int)(Math.random()*arrays.length);
        for (int i = 0; i < arrays.length; i++) {
            a = b;
            b = (int)(Math.random()*arrays.length);
            System.out.print(a+" ");
            System.out.println(b);
            arrays[a] = arrays[a]^arrays[b];
            arrays[b] = arrays[a]^arrays[b];
            arrays[a] = arrays[a]^arrays[b];
        }
    }


}
